package org.example.mybatis.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import org.example.mybatis.domain.AiSession;
import org.example.mybatis.domain.PageDomain;
import org.example.mybatis.domain.Response;
import org.example.mybatis.service.Insert;
import org.example.mybatis.service.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private Insert insert;

    @Autowired
    private Page  page;

    @RequestMapping("/insert")
    public Response<String> insert(String que){
        return Response.success(insert.insert(que));
    }

    @RequestMapping("/page")
    public Response<IPage<AiSession>> getPage(PageDomain pageDomain) {
        IPage<AiSession> sessionHistory = page.getPage(pageDomain);
        return Response.success(sessionHistory);
    }
}
